package com.lagou.client;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.List;

public class WriteList {

    //传过来的参数是泛型
    public static void wrList(List<Student> list) {
        ObjectOutputStream out = null;

        try {
            out = new ObjectOutputStream(new FileOutputStream("D:/a.txt"));
            // 写入集合对象
            out.writeObject(list);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (null != out) {
                try {
                    out.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}

